home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 July: Mac OS SDK / Dev.CD Jul 97 SDK1.toast / Development Kits (Disc 1) / QuickDraw GX / Programming Stuff / Sample Code / Typography Samples / Style Layout ƒ / QDGX shell.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-06-17  |  3.5 KB  |  128 lines  |  [TEXT/KAHL]

  1. /****************************************************************************/
  2. /*                                                                            */
  3. /*    interfaces for a simple, MULTI-window graphics shell                    */
  4. /*                                                                            */
  5. /*    6/96 bob    Updated #includes to support changed GX Library names.        */
  6. /*                Updated the copyright date.                                    */
  7. /*                                                                            */
  8. /*    ©1990 - 1996  Apple Computer, Inc.                                        */
  9. /*    All rights reserved.                                                    */
  10. /*                                                                            */
  11. /****************************************************************************/
  12.  
  13. #include <Desk.h>
  14. #include <Events.h>
  15. #include <Fonts.h>
  16. #include <Windows.h>
  17. #include <Memory.h>
  18. #include <ToolUtils.h>
  19. #include <Menus.h>
  20. #include <Resources.h>
  21. #include <Quickdraw.h>
  22. #include <GestaltEqu.h>
  23. #include <CodeFragments.h>
  24.  
  25. #include <GXEnvironment.h>
  26. #include <GXGraphics.h>
  27. #include "GraphicsLibraries.h"
  28. #include <GXErrors.h>
  29. #include "FontLibrary.h"
  30. #include "QDLibrary.h"
  31. #include <GXPrinting.h>
  32.  
  33.  
  34.  
  35.  
  36. /**\
  37. |**| ---------------------------------------------------------------------
  38. |**| EXTERN GLOBALS
  39. |**| ---------------------------------------------------------------------
  40. \**/
  41. // the following are expected to be initialized by the shell:
  42.  
  43. // QuickDraw GX shell.c:
  44.  
  45. extern Boolean        gQuitting;
  46.  
  47. // the following are expected to be initialized by your code:
  48.  
  49. extern Rect         gWindowQDRect;
  50. extern Str255        gWindowTitle;
  51. extern Boolean        gDebugging;
  52. extern Boolean        gGiveMeValidation;
  53. extern long            gGraphicsHeapSize;
  54.  
  55.  
  56.  
  57. /**\
  58. |**| ---------------------------------------------------------------------
  59. |**| PROTOTYPES
  60. |**| ---------------------------------------------------------------------
  61. \**/
  62.  
  63. // QuickDraw GX shell.c:
  64.  
  65. void    main                    (void);
  66. void     InitToolbox                (void);
  67. void    CheckQuickDrawGX        (void);
  68. OSErr    MyPrintingEventOverride    (EventRecord *event, Boolean filterEvent);
  69. void    EventLoop                (void);
  70. Boolean    IsAppWindow                (WindowPtr wind);
  71. void    MyDoEvent                (EventRecord *event);
  72. void    DoMouseDown                (EventRecord *event);
  73.  
  74. // QDGX shell misc.c:
  75.  
  76. void    DoMenuCommand            (long menuResult);
  77. gxJob    GetDocJob                (WindowPtr);
  78. gxShape    GetDocShape                (WindowPtr);
  79. short    MyStrLength                (char *s);
  80.  
  81. // QDGX shell printing.c:
  82.  
  83. void    SetUpEditMenuRec        (gxEditMenuRecord *);
  84. OSErr    DoFormat                (WindowPtr, gxDialogResult    *);
  85. OSErr    DoPrinting                (WindowPtr);
  86. OSErr    DoPrintOne                (WindowPtr);
  87.  
  88. // routines required by your code
  89. void    DoSetup                    (void);
  90. void    DoDraw                    (WindowPtr wind, Boolean updating);
  91. OSErr    DoCreateNew                (void);
  92. void    DoDispose                (WindowPtr wind);
  93. void    DoIdle                    (WindowPtr wind);
  94. void    DoTeardown                (void);
  95. void    DoClick                    (WindowPtr wind, Point p);
  96.  
  97.  
  98.  
  99. /**\
  100. |**| ---------------------------------------------------------------------
  101. |**| ENUMS
  102. |**| ---------------------------------------------------------------------
  103. \**/
  104. enum dlogIDs {rAboutBoxID=128,rNoQuickDrawGXID=129};
  105.  
  106. enum mbarID {rMenuBar=128};
  107.  
  108. enum menus {mApple=128,mFile,mEdit};
  109.  
  110. enum mApplItems {iAbout=1};
  111. enum mFileItems {iNew=1,iOpen,iClose,iSave,iPageSetup=6,iPrint,iPrintOne,iQuit=10};
  112. enum mEditItems {iUndo=1,iCut=3,iCopy,iPaste,iClear};
  113.  
  114.  
  115. /**\
  116. |**| ---------------------------------------------------------------------
  117. |**| STRUCTS
  118. |**| ---------------------------------------------------------------------
  119. \**/
  120. // This is the structure we use to hold our private data for each window.
  121. // We store a handle to one of these beasties in each window's refCon field.
  122.  
  123. typedef struct
  124. {
  125.   gxJob        docJob;            // print job for this document.
  126.   gxShape    docPage;        // page shape description for this document.
  127. } T_Doc, *TP_Doc, **TH_Doc;
  128.